<%@page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>全部活动</title>
    <%@include file="common/header.jsp" %>
</head>
<body>
<!-- page 容器 -->
<div class="page" data-router="true">
    <!-- 标题栏 -->
    <header class="bar bar-nav bgcolor nobottom">
        <button class="button button-link button-nav whitecolor pull-left" href="${ctx}/m/index.do">
            <span class="icon icon-left"></span>

        </button>
        <%@include file="common/headerPic.jsp" %>
        <a class="icon icon-search whitecolor pull-right m_right external" href="search.do?type=activity"></a>

        <h1 class="title whitecolor">全部活动</h1>
    </header>

    <!-- 工具栏 -->
    <!--<nav class="bar bar-tab">
        <a class="tab-item active" href="#">
            <span class="icon icon-home"></span>
            <span class="tab-label">首页</span>
        </a>
        <a class="tab-item" href="#">
            <span class="icon icon-star"></span>
            <span class="tab-label">收藏</span>
        </a>
        <a class="tab-item" href="#">
            <span class="icon icon-settings"></span>
            <span class="tab-label">设置</span>
        </a>
    </nav>-->

    <!-- 这里是页面内容区 -->
    <div class="content whitebg infinite-scroll" data-distance="100">
        <div class="buttons-tab">
            <a href="#tab1" class="tab-link active button">正在直播</a>
            <a href="#tab2" id="tab2Link" class="tab-link button">全部活动</a>
        </div>

        <div class="tabs">
            <div id="tab1" class="tab active graycolor">
                <%--<div class="message">已搜索到${activityPager.totalCount}场活动</div>--%>
                <div class="contentList" data-totalPage="1" data-pageNum="1">
                    <div class="live">
                        <a class="toDetail" href="">
                            <div class="live-left"><img class="mainPicUrl lazy" src="images/empty.png"
                                                        data-original="${Dict.prefix('UPLOAD')}${activity.mainPicUrl}">
                            </div>
                            <div class="live-center">
                                <div class="row_nowrap cyzjTitle"></div>
                                <div class="row_nowrap little_size cyzjGuest"></div>
                                <div class="row_nowrap little_size dwName">承办单位：</div>
                                <div class="row_nowrap little_size cyzjStartTime">开始时间：</div>
                            </div>
                            <a class="live-right living processStatus">活动状态</a>
                        </a>
                    </div>
                </div>
                <!-- preloader -->
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>

            <div id="tab2" class="tab graycolor">
                <div class="row no-gutter select_bg">
                    <a class="col-33 border_bottom border_right position select_condition" data-type="date">时间 <span
                            class="fa fa-caret-down"></span></a>
                    <a class="col-33 border_bottom border_right position select_condition" data-type="type">分类 <span
                            class="fa fa-caret-down"></span></a>
                    <a class="col-33 border_bottom border_right position select_condition" data-type="unit">承办单位 <span
                            class="fa fa-caret-down"></span></a>
                </div>
                <%--<div class="message">已搜索到${pager.totalCount}场活动</div>--%>
                <div class="select_area p_col nav_header date">
                    <div class="select_button_4  <c:if test="${pager.scMap.activityDate_I=='' || pager.scMap.activityDate_I==null}" >search_default</c:if>">
                        全部
                    </div>
                    <div class="select_button_4  <c:if test="${pager.scMap.activityDate_I=='TODAY'}" >search_default</c:if> "
                         data-value="TODAY">今天
                    </div>
                    <div class="select_button_4  <c:if test="${pager.scMap.activityDate_I=='TOMORROW'}" >search_default</c:if> "
                         data-value="TOMORROW">三天内
                    </div>
                    <div class="select_button_4  <c:if test="${pager.scMap.activityDate_I=='SATURDAY'}" >search_default</c:if> "
                         data-value="SATURDAY">三天后
                    </div>
                    <%--<div class="select_button_5 <c:if test="${pager.scMap.activityDate_I=='SUNDAY'}" >search_default</c:if> " data-value="SUNDAY" style=" margin-right: 5%;">周日</div>--%>
                    <a class="p_row little_size" style="display: block">开始时间：<input type="text" class="dataPicker"
                                                                                    style="border: none;background: #f0f0f0;color: #494949;border-bottom: 1px solid #bfbfbf;padding-left: .75rem"
                                                                                    id='datetime-picker-first'
                                                                                    value="${pager.scMap.beginTime_B}"/></a>
                    <a class="p_row p_col little_size" style="display: block;">结束时间：<input type="text"
                                                                                           class="dataPicker"
                                                                                           style="border: none;background: #f0f0f0;color: #494949;border-bottom: 1px solid #bfbfbf;padding-left: .75rem"
                                                                                           id='datetime-picker-last'
                                                                                           value="${pager.scMap.beginTime_E}"/></a>

                    <div class="search_tag  <c:if test="${pager.scMap.beginTime_B!='' || pager.scMap.beginTime_E!=''}" >search_default</c:if> "
                         data-value="SUNDAY" style=" margin-right: 5%;">查询
                    </div>
                    <!-- <div class="row" style="margin-left: 0">
                         <div class="col-50">开始时间：</div>
                         <div class="col-50">结束时间：</div>
                     </div>-->

                </div>

                <div class="select_area p_col  nav_header type">
                    <div class="search_tag <c:if test="${activity.activityType=='' || activity.activityType==null}">search_default</c:if> ">
                        全部
                    </div>
                    <c:forEach items="${Dict.getList('ACTIVITY_TYPE')}" var="item" varStatus="varStatus">
                        <div data-value="${item.KEY}"
                             class="search_tag ${activity.activityType==item.KEY?'search_default':''}">${item.VALUE}</div>
                    </c:forEach>
                </div>

                <div class="select_area p_col p_row nav_header unit">
                    <div class="search_tag  <c:if test="${activity.orgId=='' || activity.orgId==null}">search_default</c:if> ">
                        全部
                    </div>
                    <c:forEach items="${orgList}" var="org">
                        <div class="search_tag  <c:if test="${activity.orgId== org.id}">search_default</c:if>"
                             data-value="${org.id}">${org.orgName}</div>
                    </c:forEach>
                </div>

                <div class="contentList" data-totalPage="1" data-pageNum="1">
                    <div class="live">
                        <a class="toDetail" href="">
                            <div class="live-left"><img class="mainPicUrl lazy" src="images/empty.png"
                                                        data-original="${Dict.prefix('UPLOAD')}${activity.mainPicUrl}">
                            </div>
                            <div class="live-center">
                                <div class="row_nowrap cyzjTitle"></div>
                                <div class="row_nowrap little_size cyzjGuest"></div>
                                <div class="row_nowrap little_size dwName">承办单位：</div>
                                <div class="row_nowrap little_size cyzjStartTime">开始时间：</div>
                            </div>
                            <a class="live-right living processStatus">活动状态</a>
                        </a>
                    </div>
                </div>
                <!-- preloader -->
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>

        </div>
    </div>
</div>

<%@include file="common/panel.jsp" %>
</body>
</html>
<%@include file="common/footer.jsp" %>
<%@include file="common/nav_header_new.jsp" %>
<script>


    $.init();
    initTab();
    $("#datetime-picker-first").datetimePicker({
        toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker" style="color: red">确定</button>\
    <h1 class="title">选择日期和时间</h1>\
    </header>'
    });
    $("#datetime-picker-last").datetimePicker({
        toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker" style="color: red">确定</button>\
    <h1 class="title">选择日期和时间</h1>\
    </header>'
    });

    var objBase = $(".tab.active  .contentList > .live").eq(0).clone();
    var contentList = $(".contentList");
    contentList.empty();

    var loading = false;
    var url = "activityPager.do";
    function addItems(data, content) {
        $.each(data.resultList, function () {
            var obj = objBase.clone();
            obj.find(".cyzjTitle").text(getAlias('ACTIVITY_TYPE',this.activityType) + " | " + this.activityName);
            obj.find(".dwName").text("承办单位：" + this.dwName);
            if (this.guestNames =='' || this.guestNames == null || this.guestName=='null') {
                
            }else{
            	obj.find(".cyzjGuest").text("嘉宾：" + this.guestNames);
            }
            obj.find(".cyzjStartTime").text("开始时间：" + (new Date(this.beginTime)).Format("yyyy-MM-dd hh:mm"));
            obj.find(".processStatus").text(getAlias('PROCESS_STATUS',this.processStatus));
            obj.find(".toDetail").attr("href", "${ctx}/m/activityDetail.do?id=" + this.id);
            obj.find(".mainPicUrl").attr("data-original", "${Dict.prefix('UPLOAD')}" + this.mainPicUrl);
            content.append(obj);
        });
        var pageNum = parseInt(content.attr("data-pageNum")) + 1;
        content.attr("data-pageNum", pageNum);
        lazyLoad();
    }

    function queryUrl() {
        var isTab1 = $("#tab1").hasClass("active");
        if(!isTab1) {
            var date = $(".nav_header.date > .search_default").data("value") == undefined ? "" : $(".nav_header.date > .search_default").data("value");
            var type = $(".nav_header.type > .search_default").data("value") == undefined ? "" : $(".nav_header.type > .search_default").data("value");
            var unit = $(".nav_header.unit > .search_default").data("value") == undefined ? "" : $(".nav_header.unit > .search_default").data("value");
            var beginTimeS = $("#datetime-picker-first").val();
            var beginTimeE = $("#datetime-picker-last").val();
            var beginTimeSurl = beginTimeS == "" ? "" : "&map.beginTime_B=" + beginTimeS;
            var beginTimeEurl = beginTimeE == "" ? "" : "&map.beginTime_E=" + beginTimeE
            return "${ctx}/m/activityPager.do?map.activityDate_I=" + date + "&map.activityType=" + type + "&map.orgId=" + unit + beginTimeSurl + beginTimeEurl;
        }else{
            return "${ctx}/m/activityPager.do?map.processStatus=running"
        }

    }

    contentList = $(".tab.active .contentList");
    ajaxTODO(null, contentList, true);

</script>